// 引入express模块，并且初始化
const express = require('express');

const app = express();
const path = require('path');

// 通过use使用中间件，让中间件代替我们处理一些事情
app.use(express.static(path.join(__dirname, 'public')));

app.get('/', (req, res) => {
  console.log('前端正在请求后端资源');
  // console.log(1,req.app);
  // console.log(2,req.baseUrl);
  // console.log(3,req.body);
  // console.log(4,req.cookies);
  // console.log(5,req.hostname);
  // console.log(6,req.path);
  // console.log(7,req.protocol);
  // console.log(8,req.params);
  // console.log(9,req.route);
  // console.log(10,req.query);
  res.send('<mark>hello</mark>');
})

let sever = app.listen(3000, '127.0.0.1', () => {
  let host  = sever.address().address;
  let port = sever.address().port;
  console.log('ok!',host,port)
})